package org.gruposp2p.proyectokarma.gwt.client.ui.admin;

import java.math.BigDecimal;
import org.gruposp2p.proyectokarma.gwt.client.MainEntryPoint;
import org.gruposp2p.proyectokarma.gwt.client.domain.Role.RoleType;
import org.gruposp2p.proyectokarma.gwt.client.util.ServerPaths;

import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class AdminPanel extends Composite {

	private static StartPanelUiBinder uiBinder = GWT
			.create(StartPanelUiBinder.class);

	interface StartPanelUiBinder extends UiBinder<Widget, AdminPanel> {	}

	 @UiField Anchor dbConsoleLink; 
	 @UiField Anchor superAdminLink; 
	 @UiField Anchor adminLink; 
	 @UiField Anchor userLink; 
	
	 public AdminPanel() {
		 initWidget(uiBinder.createAndBindUi(this));
		 dbConsoleLink.addClickHandler(new ClickHandler(){
			 public void onClick(ClickEvent event) { 
        		ServerPaths.openInNewTab(ServerPaths.getDBConsolePath());
			 }});
		 superAdminLink.addClickHandler(new ClickHandler(){
			 public void onClick(ClickEvent event) { 
				 MainEntryPoint.INSTANCE.getTopPanel().setMenuBar(RoleType.ROLE_SUPERADMIN);
			 }});
		 adminLink.addClickHandler(new ClickHandler(){
			 public void onClick(ClickEvent event) { 
				 MainEntryPoint.INSTANCE.getTopPanel().setMenuBar(RoleType.ROLE_ADMIN);
			 }});
		 userLink.addClickHandler(new ClickHandler(){
			 public void onClick(ClickEvent event) { 
				 MainEntryPoint.INSTANCE.getTopPanel().setMenuBar(RoleType.ROLE_USER);
			 }});
	 }

}
